/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package regulatoryInteractionsStats.yeast.bioJava;

import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.TreeMap;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.biojava3.core.sequence.DNASequence;
import org.biojava3.core.sequence.template.Sequence;


/**
 *
 * @author jamie
 */
public class SequenceFactory extends TreeMap<String, Sequence> {
    
    public Sequence getSequence(String accession, String sequenceString){
        if(this.containsKey(accession)){
            return this.get(accession);
        } else {
            try {

                Sequence sequence = new DNASequence(sequenceString);
                this.put(accession, sequence);
                return sequence;
            } catch (Exception ex) {
                Logger.getLogger(SequenceFactory.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
        return null;
    }

    public Collection<Sequence> getSequences() {
        return this.values();
    }



}
